package cn.geminis.workflow.client;

import cn.geminis.lowcode.annotation.QueryFilter;
import cn.geminis.lowcode.annotation.QueryFilterProperty;
import lombok.Getter;
import lombok.Setter;

import java.util.Date;

/**
 * @author puddi
 */
@Getter
@Setter
@QueryFilter(jpa = false)
public class Task {

    private String id;
    private String taskDefinitionId;
    private String taskDefinitionKey;
    private String name;
    private String assignee;
    private String processInstanceId;
    private String processDefinitionId;
    @QueryFilterProperty(propertyName = "createTimeBeforeOrEqual", propertyType = "java.time.LocalDateTime", filterType = QueryFilterProperty.FilterType.LessThanOrEqualTo)
    @QueryFilterProperty(propertyName = "createTimeAfterOrEqual", propertyType = "java.time.LocalDateTime", filterType = QueryFilterProperty.FilterType.GreaterThanOrEqualTo)
    private Date createTime;
    @QueryFilterProperty(propertyName = "endTimeBeforeOrEqual", propertyType = "java.time.LocalDateTime", filterType = QueryFilterProperty.FilterType.LessThanOrEqualTo)
    @QueryFilterProperty(propertyName = "endTimeAfterOrEqual", propertyType = "java.time.LocalDateTime", filterType = QueryFilterProperty.FilterType.GreaterThanOrEqualTo)
    private Date endTime;
    private String deleteReason;
    private Approve approveResult;
    private String description;

    public String getProcessDefinitionKey() {
        return processDefinitionId.split(":")[0];
    }
}
